﻿namespace ACCOUNTING
{
    using ACCOUNTING.LVY.Business;
    using ACCOUNTING.My.Resources;
    using C1.Win.C1FlexGrid;
    using C1.Win.C1FlexGrid.Util.BaseControls;
    using C1.Win.C1Input;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Diagnostics;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms;

    [DesignerGenerated]
    public class Frm_NhapSoSeri : Form
    {
        private static List<WeakReference> __ENCList = new List<WeakReference>();
        [AccessedThroughProperty("CmdAdd")]
        private Button _CmdAdd;
        [AccessedThroughProperty("CmdCancel")]
        private Button _CmdCancel;
        [AccessedThroughProperty("CmdDel")]
        private Button _CmdDel;
        [AccessedThroughProperty("CmdOK")]
        private Button _CmdOK;
        [AccessedThroughProperty("Label1")]
        private Label _Label1;
        [AccessedThroughProperty("Label12")]
        private Label _Label12;
        [AccessedThroughProperty("Label2")]
        private Label _Label2;
        [AccessedThroughProperty("Label6")]
        private Label _Label6;
        [AccessedThroughProperty("TextTenHang")]
        private TextBox _TextTenHang;
        [AccessedThroughProperty("TxtMaHang")]
        private TextBox _TxtMaHang;
        [AccessedThroughProperty("TxtSoLuong")]
        private C1NumericEdit _TxtSoLuong;
        [AccessedThroughProperty("TxtSoSerial")]
        private TextBox _TxtSoSerial;
        [AccessedThroughProperty("VSlist")]
        private C1.Win.C1FlexGrid.C1FlexGrid _VSlist;
        private IContainer components;
        public string KhoaHangHoa;
        public object ObjFrmCall;
        public int SoLuong;
        public string SoSerial;

        public Frm_NhapSoSeri()
        {
            base.Load += new EventHandler(this.Frm_NhapSoSeri_Load);
            List<WeakReference> list = __ENCList;
            lock (list)
            {
                __ENCList.Add(new WeakReference(this));
            }
            this.SoSerial = "";
            this.SoLuong = 0;
            this.InitializeComponent();
        }

        private void CmdAdd_Click(object sender, EventArgs e)
        {
            if (((this.VSlist.Rows.Count - 1) != this.SoLuong) && !Conversions.ToBoolean(Operators.NotObject(this.KiemTraSoSerial(this.TxtSoSerial.Text.Trim()))))
            {
                this.VSlist.AddItem("");
                this.VSlist[this.VSlist.Rows.Count - 1, 0] = this.VSlist.Rows.Count - 1;
                this.VSlist[this.VSlist.Rows.Count - 1, 1] = this.TxtSoSerial.Text;
                this.TxtSoSerial.Text = "";
                if ((this.VSlist.Rows.Count - 1) == this.SoLuong)
                {
                    this.CmdOK_Click(this.CmdOK, e);
                }
            }
        }

        private void CmdCancel_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }

        private void CmdDel_Click(object sender, EventArgs e)
        {
            if ((this.VSlist.Rows.Count != 1) && (this.VSlist.Row > 0))
            {
                this.VSlist.RemoveItem(this.VSlist.Row);
            }
        }

        private void CmdOK_Click(object sender, EventArgs e)
        {
            if ((this.VSlist.Rows.Count + 1) < this.SoLuong)
            {
                LVYModule.ShowWarning(modGeneral.Tranlated("Bạn nhập chưa đủ số serial!", ""));
            }
            else
            {
                string str = "";
                int num2 = this.VSlist.Rows.Count - 1;
                for (int i = 1; i <= num2; i++)
                {
                    if (str.Trim() == "")
                    {
                        str = LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[i, 1]), "", modGeneral.TypeOfValue.Nothing).ToString().Trim();
                    }
                    else
                    {
                        str = str + "," + LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[i, 1]), "", modGeneral.TypeOfValue.Nothing).ToString().Trim();
                    }
                }
                this.SoSerial = str;
                object[] arguments = new object[] { str };
                bool[] copyBack = new bool[] { true };
                NewLateBinding.LateCall(this.ObjFrmCall, null, "InsertSoSrial", arguments, null, null, copyBack, true);
                if (copyBack[0])
                {
                    str = (string) Conversions.ChangeType(RuntimeHelpers.GetObjectValue(arguments[0]), typeof(string));
                }
                this.Dispose();
            }
        }

        [DebuggerNonUserCode]
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (disposing && (this.components != null))
                {
                    this.components.Dispose();
                }
            }
            finally
            {
                base.Dispose(disposing);
            }
        }

        public void EmptyData()
        {
        }

        private void Frm_NhapSoSeri_Load(object sender, EventArgs e)
        {
            LVYModule.advFormatNumber(this.TxtSoLuong, modGeneral.H_FORMATNUMBER);
            if (LVYModule.ReturnIfNull(this.KhoaHangHoa, "", modGeneral.TypeOfValue.Nothing).ToString().Trim() != "")
            {
                this.ShowHangHoa(this.KhoaHangHoa);
            }
            this.TxtSoLuong.Value = this.SoLuong;
            if (LVYModule.ReturnIfNull(this.SoSerial, "", modGeneral.TypeOfValue.Nothing).ToString().Trim() != "")
            {
                this.ShowData(this.SoSerial);
            }
            else
            {
                this.EmptyData();
            }
        }

        [DebuggerStepThrough]
        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(Frm_NhapSoSeri));
            this.VSlist = new C1.Win.C1FlexGrid.C1FlexGrid();
            this.TxtSoSerial = new TextBox();
            this.Label6 = new Label();
            this.CmdAdd = new Button();
            this.CmdCancel = new Button();
            this.CmdOK = new Button();
            this.CmdDel = new Button();
            this.TxtMaHang = new TextBox();
            this.Label12 = new Label();
            this.TextTenHang = new TextBox();
            this.Label1 = new Label();
            this.TxtSoLuong = new C1NumericEdit();
            this.Label2 = new Label();
            this.VSlist.BeginInit();
            ((ISupportInitialize) this.TxtSoLuong).BeginInit();
            this.SuspendLayout();
            this.VSlist.BorderStyle = C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.XpThemes;
            this.VSlist.ColumnInfo = "2,0,0,0,0,90,Columns:0{Width:29;Caption:\"STT\";}\t1{Width:159;Caption:\"Số serial\";Style:\"DataType:System.String;TextAlign:LeftCenter;\";}\t";
            this.VSlist.ExtendLastCol = true;
            this.VSlist.KeyActionEnter = KeyActionEnum.MoveAcross;
            Point point = new Point(0x112, 1);
            this.VSlist.Location = point;
            Padding padding = new Padding(0);
            this.VSlist.Margin = padding;
            this.VSlist.Name = "VSlist";
            this.VSlist.Rows.Count = 1;
            this.VSlist.Rows.DefaultSize = 0x11;
            this.VSlist.Rows.MinSize = 20;
            Size size = new Size(0xe8, 0x11e);
            this.VSlist.Size = size;
            this.VSlist.StyleInfo = manager.GetString("VSlist.StyleInfo");
            this.VSlist.TabIndex = 10;
            this.VSlist.VisualStyle = C1.Win.C1FlexGrid.VisualStyle.Office2007Blue;
            this.TxtSoSerial.Font = new Font("Microsoft Sans Serif", 14f, FontStyle.Bold, GraphicsUnit.Point, 0);
            point = new Point(3, 0x1c);
            this.TxtSoSerial.Location = point;
            this.TxtSoSerial.Name = "TxtSoSerial";
            size = new Size(0xec, 0x1d);
            this.TxtSoSerial.Size = size;
            this.TxtSoSerial.TabIndex = 1;
            this.Label6.AutoSize = true;
            this.Label6.BackColor = Color.Transparent;
            point = new Point(2, 9);
            this.Label6.Location = point;
            this.Label6.Name = "Label6";
            size = new Size(0x2f, 13);
            this.Label6.Size = size;
            this.Label6.TabIndex = 0;
            this.Label6.Text = "Số serial";
            this.CmdAdd.Font = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Bold, GraphicsUnit.Point, 0);
            point = new Point(240, 0x1b);
            this.CmdAdd.Location = point;
            this.CmdAdd.Name = "CmdAdd";
            size = new Size(0x20, 0x1f);
            this.CmdAdd.Size = size;
            this.CmdAdd.TabIndex = 2;
            this.CmdAdd.Text = ">";
            this.CmdAdd.UseVisualStyleBackColor = true;
            this.CmdCancel.Image = (Image) manager.GetObject("CmdCancel.Image");
            this.CmdCancel.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(0x1ad, 0x120);
            this.CmdCancel.Location = point;
            this.CmdCancel.Name = "CmdCancel";
            size = new Size(0x4f, 0x1b);
            this.CmdCancel.Size = size;
            this.CmdCancel.TabIndex = 12;
            this.CmdCancel.Text = "&Tho\x00e1t";
            this.CmdCancel.UseVisualStyleBackColor = true;
            this.CmdOK.Image = (Image) manager.GetObject("CmdOK.Image");
            this.CmdOK.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(0x15a, 0x120);
            this.CmdOK.Location = point;
            this.CmdOK.Name = "CmdOK";
            size = new Size(0x4e, 0x1b);
            this.CmdOK.Size = size;
            this.CmdOK.TabIndex = 11;
            this.CmdOK.Text = "&Chọn";
            this.CmdOK.UseVisualStyleBackColor = true;
            this.CmdDel.Font = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Bold, GraphicsUnit.Point, 0);
            point = new Point(240, 0x40);
            this.CmdDel.Location = point;
            this.CmdDel.Name = "CmdDel";
            size = new Size(0x20, 0x1f);
            this.CmdDel.Size = size;
            this.CmdDel.TabIndex = 3;
            this.CmdDel.Text = "<";
            this.CmdDel.UseVisualStyleBackColor = true;
            point = new Point(3, 0x7f);
            this.TxtMaHang.Location = point;
            this.TxtMaHang.Name = "TxtMaHang";
            this.TxtMaHang.ReadOnly = true;
            size = new Size(0x72, 20);
            this.TxtMaHang.Size = size;
            this.TxtMaHang.TabIndex = 5;
            this.Label12.AutoSize = true;
            this.Label12.BackColor = Color.Transparent;
            point = new Point(2, 0x6f);
            this.Label12.Location = point;
            this.Label12.Name = "Label12";
            size = new Size(0x31, 13);
            this.Label12.Size = size;
            this.Label12.TabIndex = 4;
            this.Label12.Text = "M\x00e3 h\x00e0ng";
            point = new Point(3, 0xab);
            this.TextTenHang.Location = point;
            this.TextTenHang.Name = "TextTenHang";
            this.TextTenHang.ReadOnly = true;
            size = new Size(0x10c, 20);
            this.TextTenHang.Size = size;
            this.TextTenHang.TabIndex = 7;
            this.Label1.AutoSize = true;
            this.Label1.BackColor = Color.Transparent;
            point = new Point(2, 0x9b);
            this.Label1.Location = point;
            this.Label1.Name = "Label1";
            size = new Size(0x35, 13);
            this.Label1.Size = size;
            this.Label1.TabIndex = 6;
            this.Label1.Text = "T\x00ean h\x00e0ng";
            this.TxtSoLuong.BorderStyle = BorderStyle.FixedSingle;
            this.TxtSoLuong.DataType = typeof(double);
            this.TxtSoLuong.FormatType = FormatTypeEnum.Currency;
            point = new Point(3, 0xd9);
            this.TxtSoLuong.Location = point;
            this.TxtSoLuong.Name = "TxtSoLuong";
            padding = new Padding(1);
            this.TxtSoLuong.Padding = padding;
            this.TxtSoLuong.ReadOnly = true;
            size = new Size(0x72, 20);
            this.TxtSoLuong.Size = size;
            this.TxtSoLuong.TabIndex = 9;
            this.TxtSoLuong.Tag = null;
            this.TxtSoLuong.TextAlign = HorizontalAlignment.Right;
            this.TxtSoLuong.VisibleButtons = DropDownControlButtonFlags.None;
            this.TxtSoLuong.VisualStyle = C1.Win.C1Input.VisualStyle.Office2007Blue;
            this.TxtSoLuong.VisualStyleBaseStyle = C1.Win.C1Input.VisualStyle.Office2007Blue;
            this.Label2.AutoSize = true;
            this.Label2.BackColor = Color.Transparent;
            point = new Point(0, 0xc9);
            this.Label2.Location = point;
            this.Label2.Name = "Label2";
            size = new Size(0x31, 13);
            this.Label2.Size = size;
            this.Label2.TabIndex = 8;
            this.Label2.Text = "Số lượng";
            SizeF ef = new SizeF(6f, 13f);
            this.AutoScaleDimensions = ef;
            this.AutoScaleMode = AutoScaleMode.Font;
            this.BackgroundImage = ACCOUNTING.My.Resources.Resources.background;
            size = new Size(0x1fc, 0x13d);
            this.ClientSize = size;
            this.ControlBox = false;
            this.Controls.Add(this.Label2);
            this.Controls.Add(this.TxtSoLuong);
            this.Controls.Add(this.TextTenHang);
            this.Controls.Add(this.Label1);
            this.Controls.Add(this.TxtMaHang);
            this.Controls.Add(this.Label12);
            this.Controls.Add(this.CmdDel);
            this.Controls.Add(this.CmdCancel);
            this.Controls.Add(this.CmdOK);
            this.Controls.Add(this.CmdAdd);
            this.Controls.Add(this.Label6);
            this.Controls.Add(this.TxtSoSerial);
            this.Controls.Add(this.VSlist);
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.MaximizeBox = false;
            this.Name = "Frm_NhapSoSeri";
            this.StartPosition = FormStartPosition.CenterScreen;
            this.Text = "NHAP SO SERIAL";
            this.VSlist.EndInit();
            ((ISupportInitialize) this.TxtSoLuong).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();
        }

        public object KiemTraSoSerial(string strSoSerial)
        {
            int num2 = this.VSlist.Rows.Count - 1;
            for (int i = 1; i <= num2; i++)
            {
                if (LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[i, 1]), "", modGeneral.TypeOfValue.Nothing).ToString().Trim() == strSoSerial)
                {
                    return false;
                }
            }
            return true;
        }

        public void ShowData(string strSoSerial)
        {
            Array instance = this.SoSerial.Split(new char[] { ',' });
            this.VSlist.Rows.Count = 1;
            int num2 = instance.Length - 1;
            for (int i = 0; i <= num2; i++)
            {
                this.VSlist.AddItem("");
                this.VSlist[this.VSlist.Rows.Count - 1, 0] = i + 1;
                this.VSlist[this.VSlist.Rows.Count - 1, 1] = RuntimeHelpers.GetObjectValue(NewLateBinding.LateIndexGet(instance, new object[] { i }, null));
            }
        }

        public void ShowHangHoa(string strKhoa)
        {
            clsDMHangHoa hoa = new clsDMHangHoa();
            hoa.Load(strKhoa);
            this.TxtMaHang.Text = hoa.Ma;
            if (modGeneral.H_LANGUAGE.Trim().ToUpper() == "VIET")
            {
                this.TextTenHang.Text = hoa.TenViet;
            }
            else
            {
                this.TextTenHang.Text = hoa.TenAnh;
            }
        }

        private void TxtSoSerial_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Return)
            {
                this.CmdAdd_Click(this.CmdAdd, null);
            }
        }

        internal virtual Button CmdAdd
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdAdd;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdAdd_Click);
                if (this._CmdAdd != null)
                {
                    this._CmdAdd.Click -= handler;
                }
                this._CmdAdd = value;
                if (this._CmdAdd != null)
                {
                    this._CmdAdd.Click += handler;
                }
            }
        }

        internal virtual Button CmdCancel
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdCancel;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdCancel_Click);
                if (this._CmdCancel != null)
                {
                    this._CmdCancel.Click -= handler;
                }
                this._CmdCancel = value;
                if (this._CmdCancel != null)
                {
                    this._CmdCancel.Click += handler;
                }
            }
        }

        internal virtual Button CmdDel
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdDel;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdDel_Click);
                if (this._CmdDel != null)
                {
                    this._CmdDel.Click -= handler;
                }
                this._CmdDel = value;
                if (this._CmdDel != null)
                {
                    this._CmdDel.Click += handler;
                }
            }
        }

        internal virtual Button CmdOK
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdOK;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdOK_Click);
                if (this._CmdOK != null)
                {
                    this._CmdOK.Click -= handler;
                }
                this._CmdOK = value;
                if (this._CmdOK != null)
                {
                    this._CmdOK.Click += handler;
                }
            }
        }

        internal virtual Label Label1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label1 = value;
            }
        }

        internal virtual Label Label12
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label12;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label12 = value;
            }
        }

        internal virtual Label Label2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label2 = value;
            }
        }

        internal virtual Label Label6
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label6;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label6 = value;
            }
        }

        internal virtual TextBox TextTenHang
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TextTenHang;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TextTenHang = value;
            }
        }

        internal virtual TextBox TxtMaHang
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtMaHang;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TxtMaHang = value;
            }
        }

        internal virtual C1NumericEdit TxtSoLuong
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtSoLuong;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TxtSoLuong = value;
            }
        }

        internal virtual TextBox TxtSoSerial
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtSoSerial;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                KeyEventHandler handler = new KeyEventHandler(this.TxtSoSerial_KeyDown);
                if (this._TxtSoSerial != null)
                {
                    this._TxtSoSerial.KeyDown -= handler;
                }
                this._TxtSoSerial = value;
                if (this._TxtSoSerial != null)
                {
                    this._TxtSoSerial.KeyDown += handler;
                }
            }
        }

        internal virtual C1.Win.C1FlexGrid.C1FlexGrid VSlist
        {
            [DebuggerNonUserCode]
            get
            {
                return this._VSlist;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._VSlist = value;
            }
        }
    }
}

